// var n;
// var r = cc.Vec3;
// var c = cc.BlockInputEvents;
// var l = cc.Sprite.Type;
// var d = cc.Sprite.SizeMode;
// var u = cc.Label.VerticalAlign;
// var h = cc.Label.HorizontalAlign;
// var p = cc.Label.Overflow;
// var g = dragonBones.ArmatureDisplay.AnimationCacheMode;
// var f = dragonBones.DragonBonesAsset;
// var m = dragonBones.DragonBonesAtlasAsset;
// var y = cc.ProgressBar.Mode;
// var $chestDialog = require("./AL_Framework_Chest_Dialog");
// var $buttonAction = require("./AL_Framework_Button_Action");
// var w = cc._decorator;
// var S = w.ccclass;
// var C = w.property;
// var b = (function (e) {
//     function t() {
//         var t = (null !== e && e.apply(this, arguments)) || this;
//         t.node_button_collet = null;
//         t.node_button_cancel = null;
//         t.node_gift_animation = null;
//         t.progress_bar = null;
//         t.current_progress = 0;
//         t.button_start_position = new cc.Vec3(0, -550, 0);
//         t.xiaohui_huidiao = null;
//         t.reward_callback = null;
//         t.limit_time = 5;
//         t.fall_number = 10;
//         t.fall_interval = 0.5;
//         t.reward = 10;
//         t.target_progress = 0;
//         t.click_time = 0;
//         t.is_banner_show = !1;
//         return t;
//     }
//     var o;
//     __extends(t, e);
//     o = t;
//     t.prototype.onLoad = function () {
//         var e = this;
//         ailin_sdk_manager.yincangBannerGuanggao();
//         console.log("test: ", this.progress_bar, this.progress_bar.node, this.progress_bar.node.children);
//         this.node_button_cancel.active = !1;
//         this.node_button_collet.runAction(this.buttonAction);
//         this.node_button_collet.on(
//             cc.Node.EventType.TOUCH_START,
//             function () {
//                 e.node_button_collet.stopAllActions();
//                 e.node_button_collet.runAction(cc.scaleTo(0.1, 0.9));
//             },
//             this
//         );
//         this.node_button_collet.on(cc.Node.EventType.TOUCH_END, this.handle_event_button_click_collect, this);
//         this.node_button_collet.on(
//             cc.Node.EventType.TOUCH_CANCEL,
//             function () {
//                 e.node_button_collet.runAction(
//                     cc.sequence(
//                         cc.scaleTo(0.1, 1),
//                         cc.callFunc(function () {
//                             e.node_button_collet.runAction(e.buttonAction);
//                         })
//                     )
//                 );
//             },
//             this
//         );
//         this.node_button_cancel.on(
//             cc.Node.EventType.TOUCH_START,
//             function () {
//                 e.node_button_cancel.runAction(cc.scaleTo(0.1, 0.9));
//             },
//             this
//         );
//         this.node_button_cancel.on(cc.Node.EventType.TOUCH_END, this.handle_event_button_click_cancel, this);
//         this.node_button_cancel.on(
//             cc.Node.EventType.TOUCH_CANCEL,
//             function () {
//                 e.node_button_cancel.runAction(cc.scaleTo(0.1, 1));
//             },
//             this
//         );
//         var t = -(cc.winSize.height / 2 - this.node_button_collet.height);
//         this.button_start_position.y = t;
//         this.node_button_collet.position = this.button_start_position;
//         this.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).addEventListener(
//             dragonBones.EventObject.COMPLETE,
//             function () {
//                 e.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).playAnimation("dianjiddoudong", 0);
//             },
//             this
//         );
//         this.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).playAnimation("chuchang", 1);
//         ailin_sdk_manager.yincangBannerGuanggao();
//     };
//     t.prototype.start = function () {};
//     t.prototype.update = function () {
//         this.target_progress =
//             this.target_progress + 1.5 <= this.current_progress ? this.target_progress + 1.5 : this.current_progress;
//         this.progress_bar.progress = this.target_progress / 100;
//     };
//     t.prototype.chushihua_shuju = function (e) {
//         var t = this;
//         this.buttonAction = e.buttonAction
//             ? e.buttonAction
//             : cc.repeatForever(cc.sequence(cc.scaleTo(0.5, 1.1), cc.scaleTo(0.5, 1)));
//         if (e.buttonImg) {
//             cc.loader.loadRes(e.buttonImg, cc.SpriteFrame, function (e, o) {
//                 if (!e) {
//                     t.node_button_collet.getComponent(cc.Sprite).spriteFrame = o;
//                 }
//             });
//         }
//         if (e.button_start_position && e.button_start_position instanceof cc.Vec3) {
//             this.button_start_position = e.button_start_position;
//         }
//         if (e.lipin_banner_dianji_cishu) {
//             var o = e.lipin_banner_dianji_cishu.min;
//             var i = e.lipin_banner_dianji_cishu.max;
//             if (0 == isNaN(o) && 0 == isNaN(i) && o <= i) {
//                 this.limit_time = Math.floor(Math.random() * (i - o + 1) + o);
//             }
//         }
//         if (e.lipin_jindu_shibai_shuliang && !isNaN(e.lipin_jindu_shibai_shuliang)) {
//             this.fall_number = e.lipin_jindu_shibai_shuliang;
//         }
//         if (e.lipin_jindu_shibai_jiange && !isNaN(e.lipin_jindu_shibai_jiange)) {
//             this.fall_interval = e.lipin_jindu_shibai_jiange;
//         }
//         if (e.xiaohui_huidiao) {
//             this.xiaohui_huidiao = e.xiaohui_huidiao;
//         }
//         if (e.reward_callback) {
//             this.reward_callback = e.reward_callback;
//         }
//         if (e.reward) {
//             this.reward = e.reward;
//         }
//     };
//     t.prototype.handle_event_button_click_collect = function () {
//         var e = this;
//         console.log("click");
//         if (!this.is_banner_show && this.click_time++ >= this.limit_time) {
//             var t = this;
//             ailin_sdk_manager.xianshiBannerGuanggao({
//                 successCallback: function () {
//                     console.log("AL_Framework_Gift_Prefab showBannerSuccess");
//                     if (t) {
//                         t.scheduleOnce(function () {
//                             if (t && t.node_button_collet) {
//                                 t.node_button_collet.position = new r(0, -230, 0);
//                             }
//                         }, 1);
//                     }
//                     if (t) {
//                         t.scheduleOnce(function () {
//                             if (t && t.node_button_cancel) {
//                                 t.node_button_cancel.active = !0;
//                             }
//                         }, 3);
//                     }
//                 }
//             });
//         }
//         this.progress_bar.unscheduleAllCallbacks();
//         this.current_progress >= 90
//             ? ((this.current_progress = 100),
//               this.node_button_collet.off(cc.Node.EventType.TOUCH_END, this.handle_event_button_click_collect, this),
//               this.scheduleOnce(this.huoqu_jianli, 1))
//             : ((this.current_progress += 10),
//               this.progress_bar.schedule(
//                   function () {
//                       e.current_progress = e.current_progress - e.fall_number <= 0 ? 0 : e.current_progress - e.fall_number;
//                   },
//                   this.fall_interval,
//                   cc.macro.REPEAT_FOREVER,
//                   this.fall_interval
//               ),
//               this.node_button_collet.runAction(
//                   cc.sequence(
//                       cc.scaleTo(0.1, 1),
//                       cc.callFunc(function () {
//                           e.node_button_collet.runAction(e.buttonAction);
//                       })
//                   )
//               ));
//     };
//     t.prototype.handle_event_button_click_cancel = function () {
//         this.node.destroy();
//     };
//     t.prototype.huoqu_jianli = function () {
//         var e = this;
//         this.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).addEventListener(
//             dragonBones.EventObject.COMPLETE,
//             function () {
//                 if (e.reward_callback) {
//                     e.reward_callback(e.reward);
//                 }
//                 e.node.destroy();
//             },
//             this
//         );
//         this.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).playAnimation("kaiqi", 1);
//     };
//     t.prototype.onDestroy = function () {
//         if (this.xiaohui_huidiao) {
//             this.xiaohui_huidiao();
//         }
//         ailin_sdk_manager.yincangBannerGuanggao();
//     };
//     t.xianshiLiwuDuihuakuang = function (e) {
//         console.log("xianshiLiwuDuihuakuang");
//         var t = this.chuangjian_yuzhiti();
//         t.x = 360;
//         t.y = 640;
//         t.getComponent(o).chushihua_shuju(e);
//         cc.director.getScene().addChild(t);
//     };
//     t.chuangjian_yuzhiti = function () {
//         var e = new cc.Node();
//         e.height = 1280;
//         e.width = 720;
//         var t = e.addComponent(cc.Widget);
//         t.isAlignHorizontalCenter = !0;
//         t.isAlignVerticalCenter = !0;
//         var i = new cc.Node();
//         i.width = 720;
//         i.height = 1280;
//         i.addComponent(c);
//         $chestDialog.default.tianjia_jingling_tu(i, "Flower/img/common/whiteBg", l.SIMPLE, d.CUSTOM);
//         i.color = new cc.Color(0, 0, 0);
//         i.opacity = 180;
//         e.addChild(i);
//         var n = new cc.Node();
//         n.y = 400;
//         $chestDialog.default.tianjia_jingling_tu(n, "Flower/img/gift/img/title");
//         e.addChild(n);
//         var a = new cc.Node();
//         var s = a.addComponent(dragonBones.ArmatureDisplay);
//         cc.loader.loadRes("Flower/img/gift/anim/kailihe_ske", f, function (e, t) {
//             s.dragonAsset = t;
//         });
//         cc.loader.loadRes("Flower/img/gift/anim/kailihe_tex", m, function (e, t) {
//             s.dragonAtlasAsset = t;
//         });
//         s.timeScale = 1;
//         s.playTimes = -1;
//         s.armatureName = "Armature";
//         s.setAnimationCacheMode(g.REALTIME);
//         s.premultipliedAlpha = !1;
//         a.y = 95;
//         e.width = 307;
//         e.height = 329;
//         e.addChild(a);
//         var r = new cc.Node();
//         r.x = 0;
//         r.y = -115;
//         $chestDialog.default.tianjia_jingling_tu(r, "Flower/img/gift/img/progressBg", l.SLICED, d.CUSTOM);
//         var w = r.addComponent(cc.ProgressBar);
//         var S = new cc.Node();
//         $chestDialog.default.tianjia_jingling_tu(S, "Flower/img/gift/img/progress", l.SLICED, d.CUSTOM);
//         r.addChild(S);
//         w.barSprite = S.getComponent(cc.Sprite);
//         S.anchorX = 0;
//         S.x = -190;
//         S.height = 18;
//         S.width = 380;
//         w.totalLength = 380;
//         w.mode = y.HORIZONTAL;
//         r.width = 380;
//         r.height = 18;
//         e.addChild(r);
//         var C = new cc.Node();
//         C.width = 291;
//         C.height = 104;
//         $chestDialog.default.tianjia_jingling_tu(C, "Flower/img/gift/img/button", l.SIMPLE, d.CUSTOM);
//         C.anchorY = 0;
//         C.addComponent($buttonAction.default);
//         C.y = -cc.view.getFrameSize().height / 2 + 50;
//         e.addChild(C);
//         var b = new cc.Node();
//         b.width = 110;
//         b.height = 19;
//         var A = b.addComponent(cc.Label);
//         A.string = "算了，下次吧";
//         A.overflow = p.RESIZE_HEIGHT;
//         A.horizontalAlign = h.CENTER;
//         A.verticalAlign = u.CENTER;
//         A.fontSize = 15;
//         A.lineHeight = 15;
//         var N = new cc.Node();
//         N.width = 110;
//         N.height = 1;
//         $chestDialog.default.tianjia_jingling_tu(N, "Flower/img/common/whiteBg", l.SIMPLE, d.CUSTOM);
//         N.y = -10;
//         b.addChild(N);
//         b.y = -310;
//         e.addChild(b);
//         var I = e.addComponent(o);
//         I.node_button_collet = C;
//         I.node_button_cancel = b;
//         I.node_gift_animation = a;
//         I.progress_bar = w;
//         return e;
//     };
//     __decorate([C(cc.Node)], t.prototype, "node_button_collet", void 0);
//     __decorate([C(cc.Node)], t.prototype, "node_button_cancel", void 0);
//     __decorate([C(cc.Node)], t.prototype, "node_gift_animation", void 0);
//     __decorate([C(cc.ProgressBar)], t.prototype, "progress_bar", void 0);
//     return (o = __decorate([S], t));
// })(cc.Component);
// exports.default = b;


const Vec3 = cc.Vec3;
const BlockInputEvents = cc.BlockInputEvents;
const SpriteType = cc.Sprite.Type;
const SizeMode = cc.Sprite.SizeMode;
const VerticalAlign = cc.Label.VerticalAlign;
const HorizontalAlign = cc.Label.HorizontalAlign;
const Overflow = cc.Label.Overflow;
const AnimationCacheMode = dragonBones.ArmatureDisplay.AnimationCacheMode;
const DragonBonesAsset = dragonBones.DragonBonesAsset;
const DragonBonesAtlasAsset = dragonBones.DragonBonesAtlasAsset;
const ProgressBarMode = cc.ProgressBar.Mode;

const AL_Framework_Chest_Dialog = require("./AL_Framework_Chest_Dialog");
const AL_Framework_Button_Action = require("./AL_Framework_Button_Action");

const { ccclass, property } = cc._decorator;

/**
 * @classdesc 礼物动画展示类
 */
@ccclass
class GiftAnimation extends cc.Component {
    @property(cc.Node)
    node_button_collet = null;

    @property(cc.Node)
    node_button_cancel = null;

    @property(cc.Node)
    node_gift_animation = null;

    @property(cc.ProgressBar)
    progress_bar = null;

    current_progress = 0;
    button_start_position = new Vec3(0, -550, 0);
    xiaohui_huidiao = null;
    reward_callback = null;
    limit_time = 5;
    fall_number = 10;
    fall_interval = 0.5;
    reward = 10;
    target_progress = 0;
    click_time = 0;
    is_banner_show = false;

    onLoad() {
        const self = this;
        ailin_sdk_manager.yincangBannerGuanggao();
        console.log("test: ", self.progress_bar, self.progress_bar.node, self.progress_bar.node.children);
        self.node_button_cancel.active = false;
        self.node_button_collet.runAction(self.buttonAction);
        
        self.node_button_collet.on(cc.Node.EventType.TOUCH_START, () => {
            self.node_button_collet.stopAllActions();
            self.node_button_collet.runAction(cc.scaleTo(0.1, 0.9));
        }, self);

        self.node_button_collet.on(cc.Node.EventType.TOUCH_END, self.handle_event_button_click_collect, self);
        
        self.node_button_collet.on(cc.Node.EventType.TOUCH_CANCEL, () => {
            self.node_button_collet.runAction(
                cc.sequence(
                    cc.scaleTo(0.1, 1),
                    cc.callFunc(() => {
                        self.node_button_collet.runAction(self.buttonAction);
                    })
                )
            );
        }, self);

        self.node_button_cancel.on(cc.Node.EventType.TOUCH_START, () => {
            self.node_button_cancel.runAction(cc.scaleTo(0.1, 0.9));
        }, self);

        self.node_button_cancel.on(cc.Node.EventType.TOUCH_END, self.handle_event_button_click_cancel, self);
        
        self.node_button_cancel.on(cc.Node.EventType.TOUCH_CANCEL, () => {
            self.node_button_cancel.runAction(cc.scaleTo(0.1, 1));
        }, self);

        const buttonPosY = -(cc.winSize.height / 2 - self.node_button_collet.height);
        self.button_start_position.y = buttonPosY;
        self.node_button_collet.position = self.button_start_position;

        self.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).addEventListener(
            dragonBones.EventObject.COMPLETE,
            () => {
                self.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).playAnimation("dianjiddoudong", 0);
            },
            self
        );
        self.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).playAnimation("chuchang", 1);
        ailin_sdk_manager.yincangBannerGuanggao();
    }
    
    start() {}

    update() {
        this.target_progress = this.target_progress + 1.5 <= this.current_progress ? this.target_progress + 1.5 : this.current_progress;
        this.progress_bar.progress = this.target_progress / 100;
    }

    /**
     * 初始化数据
     * @param {Object} e 配置对象
     */
    chushihua_shuju(e) {
        const self = this;
        this.buttonAction = e.buttonAction
            ? e.buttonAction
            : cc.repeatForever(cc.sequence(cc.scaleTo(0.5, 1.1), cc.scaleTo(0.5, 1)));

        if (e.buttonImg) {
            cc.loader.loadRes(e.buttonImg, cc.SpriteFrame, (err, spriteFrame) => {
                if (!err) {
                    self.node_button_collet.getComponent(cc.Sprite).spriteFrame = spriteFrame;
                }
            });
        }

        if (e.button_start_position && e.button_start_position instanceof Vec3) {
            this.button_start_position = e.button_start_position;
        }

        if (e.lipin_banner_dianji_cishu) {
            const min = e.lipin_banner_dianji_cishu.min;
            const max = e.lipin_banner_dianji_cishu.max;
            if (!isNaN(min) && !isNaN(max) && min <= max) {
                this.limit_time = Math.floor(Math.random() * (max - min + 1) + min);
            }
        }

        if (e.lipin_jindu_shibai_shuliang && !isNaN(e.lipin_jindu_shibai_shuliang)) {
            this.fall_number = e.lipin_jindu_shibai_shuliang;
        }

        if (e.lipin_jindu_shibai_jiange && !isNaN(e.lipin_jindu_shibai_jiange)) {
            this.fall_interval = e.lipin_jindu_shibai_jiange;
        }

        if (e.xiaohui_huidiao) {
            this.xiaohui_huidiao = e.xiaohui_huidiao;
        }

        if (e.reward_callback) {
            this.reward_callback = e.reward_callback;
        }

        if (e.reward) {
            this.reward = e.reward;
        }
    }

    handle_event_button_click_collect() {
        const self = this;
        console.log("click");
        
        if (!this.is_banner_show && this.click_time++ >= this.limit_time) {
            const self = this;
            ailin_sdk_manager.xianshiBannerGuanggao({
                successCallback: () => {
                    console.log("AL_Framework_Gift_Prefab showBannerSuccess");
                    if (self) {
                        self.scheduleOnce(() => {
                            if (self && self.node_button_collet) {
                                self.node_button_collet.position = new Vec3(0, -230, 0);
                            }
                        }, 1);
                    }
                    if (self) {
                        self.scheduleOnce(() => {
                            if (self && self.node_button_cancel) {
                                self.node_button_cancel.active = true;
                            }
                        }, 3);
                    }
                }
            });
        }

        this.progress_bar.unscheduleAllCallbacks();

        if (this.current_progress >= 90) {
            this.current_progress = 100;
            this.node_button_collet.off(cc.Node.EventType.TOUCH_END, this.handle_event_button_click_collect, this);
            this.scheduleOnce(this.huoqu_jianli, 1);
        } else {
            this.current_progress += 10;
            this.progress_bar.schedule(() => {
                self.current_progress = self.current_progress - self.fall_number <= 0 ? 0 : self.current_progress - self.fall_number;
            }, this.fall_interval, cc.macro.REPEAT_FOREVER, this.fall_interval);

            this.node_button_collet.runAction(
                cc.sequence(
                    cc.scaleTo(0.1, 1),
                    cc.callFunc(() => {
                        self.node_button_collet.runAction(self.buttonAction);
                    })
                )
            );
        }
    }

    handle_event_button_click_cancel() {
        this.node.destroy();
    }

    huoqu_jianli() {
        const self = this;
        self.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).addEventListener(
            dragonBones.EventObject.COMPLETE,
            () => {
                if (self.reward_callback) {
                    self.reward_callback(self.reward);
                }
                self.node.destroy();
            },
            self
        );
        self.node_gift_animation.getComponent(dragonBones.ArmatureDisplay).playAnimation("kaiqi", 1);
    }

    onDestroy() {
        if (this.xiaohui_huidiao) {
            this.xiaohui_huidiao();
        }
        ailin_sdk_manager.yincangBannerGuanggao();
    }

    /**
     * 显示礼物对话框
     * @param {Object} e 配置对象
     */
    static xianshiLiwuDuihuakuang(e) {
        console.log("xianshiLiwuDuihuakuang");
        const prefab = this.chuangjian_yuzhiti();
        prefab.x = 360;
        prefab.y = 640;
        prefab.getComponent(GiftAnimation).chushihua_shuju(e);
        cc.director.getScene().addChild(prefab);
    }

    /**
     * 创建预制件
     * @returns {cc.Node} 返回创建的节点
     */
    static chuangjian_yuzhiti() {
        const node = new cc.Node();
        node.height = 1280;
        node.width = 720;

        const widget = node.addComponent(cc.Widget);
        widget.isAlignHorizontalCenter = true;
        widget.isAlignVerticalCenter = true;

        const bgNode = new cc.Node();
        bgNode.width = 720;
        bgNode.height = 1280;
        bgNode.addComponent(BlockInputEvents);

        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(bgNode, "Flower/img/common/whiteBg", SpriteType.SIMPLE, SizeMode.CUSTOM);
        bgNode.color = new cc.Color(0, 0, 0);
        bgNode.opacity = 180;
        node.addChild(bgNode);

        const titleNode = new cc.Node();
        titleNode.y = 400;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(titleNode, "Flower/img/gift/img/title");
        node.addChild(titleNode);

        const animNode = new cc.Node();
        const animDisplay = animNode.addComponent(dragonBones.ArmatureDisplay);

        cc.loader.loadRes("Flower/img/gift/anim/kailihe_ske", DragonBonesAsset, (err, asset) => {
            animDisplay.dragonAsset = asset;
        });

        cc.loader.loadRes("Flower/img/gift/anim/kailihe_tex", DragonBonesAtlasAsset, (err, asset) => {
            animDisplay.dragonAtlasAsset = asset;
        });

        animDisplay.timeScale = 1;
        animDisplay.playTimes = -1;
        animDisplay.armatureName = "Armature";
        animDisplay.setAnimationCacheMode(AnimationCacheMode.REALTIME);
        animDisplay.premultipliedAlpha = false;

        animNode.y = 95;
        node.width = 307;
        node.height = 329;
        node.addChild(animNode);

        const progressBarNode = new cc.Node();
        progressBarNode.x = 0;
        progressBarNode.y = -115;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(progressBarNode, "Flower/img/gift/img/progressBg", SpriteType.SLICED, SizeMode.CUSTOM);

        const progressBar = progressBarNode.addComponent(cc.ProgressBar);

        const barSpriteNode = new cc.Node();
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(barSpriteNode, "Flower/img/gift/img/progress", SpriteType.SLICED, SizeMode.CUSTOM);
        progressBarNode.addChild(barSpriteNode);

        progressBar.barSprite = barSpriteNode.getComponent(cc.Sprite);
        barSpriteNode.anchorX = 0;
        barSpriteNode.x = -190;
        barSpriteNode.height = 18;
        barSpriteNode.width = 380;

        progressBar.totalLength = 380;
        progressBar.mode = ProgressBarMode.HORIZONTAL;
        progressBarNode.width = 380;
        progressBarNode.height = 18;
        node.addChild(progressBarNode);

        const buttonNode = new cc.Node();
        buttonNode.width = 291;
        buttonNode.height = 104;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(buttonNode, "Flower/img/gift/img/button", SpriteType.SIMPLE, SizeMode.CUSTOM);
        buttonNode.anchorY = 0;
        buttonNode.addComponent(AL_Framework_Button_Action.default);
        buttonNode.y = -cc.view.getFrameSize().height / 2 + 50;
        node.addChild(buttonNode);

        const cancelButtonNode = new cc.Node();
        cancelButtonNode.width = 110;
        cancelButtonNode.height = 19;

        const cancelLabel = cancelButtonNode.addComponent(cc.Label);
        cancelLabel.string = "算了，下次吧";
        cancelLabel.overflow = Overflow.RESIZE_HEIGHT;
        cancelLabel.horizontalAlign = HorizontalAlign.CENTER;
        cancelLabel.verticalAlign = VerticalAlign.CENTER;
        cancelLabel.fontSize = 15;
        cancelLabel.lineHeight = 15;

        const cancelLineNode = new cc.Node();
        cancelLineNode.width = 110;
        cancelLineNode.height = 1;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(cancelLineNode, "Flower/img/common/whiteBg", SpriteType.SIMPLE, SizeMode.CUSTOM);
        cancelLineNode.y = -10;
        cancelButtonNode.addChild(cancelLineNode);

        cancelButtonNode.y = -310;
        node.addChild(cancelButtonNode);

        const component = node.addComponent(GiftAnimation);
        component.node_button_collet = buttonNode;
        component.node_button_cancel = cancelButtonNode;
        component.node_gift_animation = animNode;
        component.progress_bar = progressBar;

        return node;
    }
}

exports.default = GiftAnimation;
